Public Class UseColors
    Dim ColorDB As New ColorDialog()

    Private Sub BtnForeColor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnForeColor.Click
        ColorDB.CustomColors = New Integer() _
            {&HFF00FF, &HFF0000, &HF0F0F0, &HF0F0F0, _
             &HAAAAAA, &HBBBBBB, &HCCCCCC, &HDDDDDD, _
             &HEEEEEE, &HAAA0A0, &HBBB0B0, &HCCC0C0, _
             &HDDD0D0, &H111111, &H333333, &H888888}

        If (ColorDB.ShowDialog() = DialogResult.OK) Then
            TextBox1.ForeColor = ColorDB.Color
        End If
    End Sub

    Private Sub BtnBackColor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBackColor.Click
        If (ColorDB.ShowDialog() = DialogResult.OK) Then
            TextBox1.BackColor = ColorDB.Color
        End If
    End Sub

End Class
